package com.ruoyi.project.cms.function.controller;

import com.ruoyi.project.cms.function.service.FunctionService;
import com.ruoyi.project.cms.menu.domain.SysMenu;
import com.ruoyi.project.cms.menu.service.SysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * 公司:
 * 作者:胖虎
 * 类名:FunctionController
 * 描述:
 * 时间:2020-05-21
 */
@Controller
@RequestMapping("/cms/function")
public class FunctionController {

    private String prefix = "cms/function";


    @Autowired
    private FunctionService functionService;


    @Autowired
    private SysMenuService menuService ;

    /**
     * 常规功能页面的跳转
     *
     * @return
     */
    @GetMapping()
    public String  function(ModelMap  mmap) {

        SysMenu   menu=new SysMenu();
        Long  parentId=0L;
        menu.setParentId(parentId);
        List<SysMenu> list = menuService.selectMenuList(menu);
        mmap.put("menu", list);

        return prefix + "/function";

    }



    @GetMapping("/update")
    public String  function(SysMenu  menu  ) {
           System.out.println("我是谁"+menu);
        int  index = menuService.updateMenu(menu);


        return "cms/menu/menu";

    }



}
